﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteContent.Master" Inherits="System.Web.Mvc.ViewPage<ProjectFitus.Models.ArticleContent>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Brjostagjof.is | Breyta grein | <%= Model.title %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/ckeditor/ckeditor.js"></script>
    <script type="text/javascript" src="../../Scripts/ArticleScripts.js"></script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Breyta grein</h2>

    <% using (Html.BeginForm()) {%>
        <%= Html.ValidationSummary(true) %>
        
        <fieldset>
            <legend> Breyta grein </legend>
                      
            <div class="editor-label">
                <label for="isActive">Birta grein: </label>
            </div>
            <div class="editor-field">
                <%= Html.CheckBoxFor(model => model.isActive) %>
                <%= Html.ValidationMessageFor(model => model.isActive) %>
            </div>
                                    
            <div class="editor-label">
                <label for="title">Fyrirsögn:</label>
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.title) %>
                <%= Html.ValidationMessageFor(model => model.title) %>
            </div>

            <div class="editor-label">
                <label for="contentText">Flokkur:</label>
            </div>
            <div class="editor-field">
            <select name="Cats" id="Cats">
                <%= ViewData["Cats"] %>
            </select>
            </div>
            <br />
            <div class="editor-field">
                <label for="contentText">Bættu við höfundi: </label>
                <select id="UserList" name="UserList">
                </select>
                <script id="UserListTemplate" type="text/x-jquery-tmpl">
                    <option value="${Value}">${Text}</option>
                </script>
                <input type="button" id="btnAddAuthor" name="btnAddAuthor" value="Bæta við" />
            </div>

            <div>
                <fieldset>
                    <legend>Höfundar greinar</legend>
                    <p id="authorsList">
                    </p>
                    <script id="authorListTemplate" type="text/x-jquery-tmpl">
                        <div>
                        <input type="button" onclick="javascript:removeAuthor(${usrId});" name="usrDel${usrId}" id="usrDel${usrId}" value="x" alt="Smelltu til að fjarlægja þennan höfund" /> 
                        <a href="Details/${usrId}">${usrFirstName} ${usrLastName}</a>       
                        </div>
                    </script>
                </fieldset>
            </div>

                                
            <div class="editor-label">
                <label for="contentText">Grein:</label>
            </div>
            <div class="editor-field">
                <%= Html.TextAreaFor(model => model.contentText) %>
                <script type="text/javascript">CKEDITOR.replace('contentText');</script>
                <%= Html.ValidationMessageFor(model => model.contentText) %>
            </div>
            
            <div class="editor-label">
                <label for="introText">Útdráttur:</label>
            </div>
            <div class="editor-field">
                <%= Html.TextAreaFor(model => model.introText) %>
                <script type="text/javascript">CKEDITOR.replace('introText');</script> 
                <%= Html.ValidationMessageFor(model => model.introText) %>
            </div>
            
            <p>
                <input type="submit" value="Vista" />
            </p>
            <input type="hidden" id="articleId" name="articleId" value="<%: Model.id %>" />
            <input type="hidden" id="oldCategoryId" name="oldCategoryId" value="<%: ViewData["oldCatId"] %>" />
            <input type="hidden" id="dateCreated" name="dateCreated" value="<%: Model.dateCreated %>" />
            <input type="hidden" id="submittedByUserId" name="submittedByUserId" value="<%: Model.submittedByUserId %>" />
            <input type="hidden" id="Hidden1" name="acceptedByUserId" value="<%: Model.submittedByUserId %>" />
            <input type="hidden" id="viewCount" name="viewCount" value="<%: Model.viewCount %>" />
        </fieldset>

    <% } %>

    <div>
        <%= Html.ActionLink("Aftur í greinalista", "Index") %>
    </div>
</asp:Content>

